package org.ch00.test08.demo3;

import java.util.Random;

/**
 * 小偷
 *
 * @author ZJL
 * @date 2025-03-04
 */
public class Thief {

    public void steal(Door door) {
        System.out.println("准备偷东西");

        if (door instanceof org.ch00.test08.demo3.AntiTheft) {
            ((AntiTheft) door).ring();
            System.out.println("你已被发现！");
        }

        int rand = new Random().nextInt(2);
        if (rand == 0) {
            System.out.println("偷盗失败...");
            return;
        }

        System.out.println("偷盗成功！");
    }
}
